package com.ricky.service_hospital.utils;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ricky.common_util.result.ResultCodeEnum;
import com.ricky.service_hospital.service.HospitalSetService;
import com.ricky.service_util.common.exception.ReservationException;
import com.ricky.service_util.common.utils.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SignKeyVerification {
    @Autowired
    HospitalSetService hospitalSetService;

    public SignKeyVerification(HospitalSetService hospitalSetService) {
        this.hospitalSetService = hospitalSetService;
    }

    public boolean verifyMD5(String hoscode,String remoteSignKey){
        String signKey = hospitalSetService.getSignKey(hoscode);
        String signKeyMD5 = MD5.encrypt(signKey);
        if(!signKeyMD5.equals(remoteSignKey)){
            return false;
        }else{
            return true;
        }

    }
}
